/**
 * File: robot_sensor_util.h
 * Brief: 
 * Created by: zhangping
 * Created at: 2017.07.17
 * Modified by:
 * Modified at:
 */


#ifndef ROBOT_SENSOR_UTIL_
#define ROBOT_SENSOR_UTIL_

#include <pthread.h>
#include "communication.h"
#include "ros/ros.h"

namespace robot_node {
    /**
     * @class SensorThread
     * @brief 
     */
    class SensorThread{
      private:
        pthread_t tid_;
        Communication com_;
        ros::NodeHandle &node_;
        
        // Handler for thread.
        static void *_thread_handler(void* this_);
        
        // Clean threads.
        void _clean_threads();
        
      public:
        // Create thread pool.
        SensorThread(ros::NodeHandle &n, Communication &com);
        pthread_t GetPid();

        // Destroy thread pool.
        ~SensorThread();
    };
    
}

#endif
